#include "Comm.hpp"

int main()
{
    //打开文件
    int wfd = open(Path, O_WRONLY);
    if(wfd < 0)
    {
        cerr<<"open fail, errno: "<<errno<<"stringerrno: "<<strerror(errno)<<endl;
        return 1;
    }
    //写文件
    string inbuffer;
    while (true)
    {
        cout<<"Please message: "<<endl;
        getline(cin, inbuffer);//写
        if(inbuffer == "quit") break;
        ssize_t n = write(wfd, inbuffer.c_str(), inbuffer.size());
        if(n < 0)
        {
            cerr<<"write fail, errno: "<<errno<<"stringerrno: "<<strerror(errno)<<endl;
            break;
        }
    }
    

    //关闭文件
    close(wfd);
    return 0;
}